package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;

public class InputStreamReadTest {
    public static void main(String[] args) {
        FileInputStream fileInputStream = null;
        InputStreamReader inputStreamReader =null;
        char[] chars = new char[1024];
        int count=0;
        try {
            fileInputStream = new FileInputStream("d:/1.jpg");
            inputStreamReader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8);
            while ((count=inputStreamReader.read(chars))!=-1){
                System.out.println(new String(chars));
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
